{% extends "personal_center/base.html" %}

{% block page_link %}
    <script type="text/javascript" src="../../static/personal_center/js/jquery.min.js"></script>
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link rel="stylesheet" href="../../static/personal_center/css/multiple-select.min.css">
    <link rel="stylesheet" href="../../static/personal_center/css/index.css">
{% endblock %}


{% block style %}
    <style>
        ::-webkit-scrollbar{  width: 6px; height: 6px;}
        ::-webkit-scrollbar-track { background-color: white;}
        ::-webkit-scrollbar-thumb{  border-radius:5px; background-color: #00688B;}
        * {
            margin:0;padding:0;
        }
        #YB_mulu div{
            font-size:0;overflow: hidden;white-space: nowrap;text-overflow:ellipsis;
        }
        .module1:hover {
            background: #DFDFDF;
        }
        #DB_mulu div{
            font-size:0;overflow: hidden;white-space: nowrap;text-overflow:ellipsis;
        }
        #LH_mulu div{
            font-size:0;overflow: hidden;white-space: nowrap;text-overflow:ellipsis;
        }
        .add_class {
            background: #1E90FF;
        }
        tr {
            height: 35px;
        }
        th {
            text-align: center;
        }
        table {
            table-layout: fixed;
        }
        td:first-child, th:first-child {
            position: sticky;left: 0;z-index: 1;
        }
        thead tr th {
            position: sticky;top: 0;background-color: #E8E8E8;
        }
        th:first-child {
            z-index: 2;
        }
        .model_li {
            color: #3f414d;width: 25%;cursor: pointer;display: none;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        #addForm {
            width: 800px;height: 620px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: none;z-index: 10100;font-size: 0;
        }
        #title {
            display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 50px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        .shade {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        .module1 {
            width: 100%;height: 40px;line-height: 40px;
        }
        .button_for_control {
            width: 90px;height: 30px;border: 1px solid #99D3F5;background: #D0EEFF;border-radius: 4px;letter-spacing: 0;line-height: 30px;color: #089bab;margin: 5px 0;
        }
        .shade1 {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        .switch-div {
            width: 100px;height: 40px;display: inline-block;vertical-align: top;cursor: pointer;
        }
        .switch-active {
            border-bottom: #00a0e9;color: #00a0e9;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 20%;height: 96%;margin-top: 1%;display: inline-block;vertical-align: top;margin-left: 1%;background-color: white;border: #cfcfcf solid 1px;">
        <div class="nav_list" style="width: 100%;border-bottom: #cfcfcf dashed 1px;">
            {% for datum in left_nav %}
                <div style="padding-left: 15px;width: 100%;border-bottom: #cfcfcf dashed 1px;height: 40px;line-height: 40px;cursor: pointer;" onclick="search_topic('{{ datum.id }}', '{{ datum.name }}')">
                    {{ datum.name }}
                </div>
            {% endfor %}
        </div>
    </div>

    <div id="my_application" style="width: 75%;height: 96%;margin-top: 1%;display: inline-block;vertical-align: top;margin-left: 1%;background-color: white;letter-spacing: 0;border: #cfcfcf solid 1px;">
        <div style="width: 100%;height: 94%;">
            <div id="YB_mulu" style="width: 100%;height: 100%;overflow: auto;margin-top: 5px;"><!--startprint-->
                <div id="container" style="width: 100%;font-size: 0;padding: 0;margin: 0;">
                    <div style="width: 100%;height: 40px;">
                        <div style="width: 100%;height: 100%;line-height: 40px;border-bottom: #999999 solid 1px;text-align: center;">
                            <strong id="committee_title" style="font-size: 20px;">{{ meeting_name }}</strong>
                            {% if liaison_obj == 'true' %}
                                <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;font-size: 14px;">
                                    <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                                            style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                                        操作
                                    </button>
                                </div>
                            {% endif %}

                            <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                                 style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 3.1%; top: 101px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
                                <button onclick="model_line('start')" class="button_for_control" style="border: #cfcfcf solid 1px;border-radius: 3px;background: #0d8ddb;color: white;display: block;font-size: 14px;">开始会议</button>
                                <button onclick="model_line('end')" class="button_for_control" style="border: #cfcfcf solid 1px;border-radius: 3px;background: #ff2222;color: white;display: block;font-size: 14px;">结束会议</button>
                                <button onclick="SignDetail()" class="button_for_control" style="border: #cfcfcf solid 1px;border-radius: 3px;background: #00A680;color: white;display: block;font-size: 14px;">签到详情</button>
                                <button onclick="open_check_in_code()" class="button_for_control" style="border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;display: block;font-size: 14px;">签到码</button>
                            </div>
                        </div>
                    </div>

                    <div style="width: 100%;height: 40px;">
                        <div style="width: 3%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;border-left: none;"></div>
                        <div style="width: 3%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">序号</div>
                        <div style="width: 34%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">议题名称</div>
                        <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">议题编号</div>
                        <div style="width: 10%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">提交人</div>
                        <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">提交时间</div>
                        <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">投票结果</div>
                        <div style="width: 11%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;border-right: none;">操作</div>
                    </div>

                    <div style="width: 100%;" id="topic_list">
                        {% for foo in meet_list %}
                            <div class="module1" style="width: 100%;">
                                <div style="width: 3%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;cursor: move;border-left: none;">
                                    <i style="font-size: 14px;" class="gm-icon gm-icon-move"></i>
                                </div>
                                <div class="YbSerial" style="width: 3%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">{{ foo.Serial }}</div>
                                <div style="width: 34%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;padding-left: 3px;" title="{{ foo.topic_name }}"><a href="topic_voting_details.html?id={{ foo.id }}">{{ foo.topic_name }}</a></div>
                                <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;" title="{{ foo.number }}">{{ foo.number }}</div>
                                <div style="width: 10%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">{{ foo.apply_user }}</div>
                                <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">{{ foo.create_time }}</div>
                                <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">
                                    {% if foo.state == 'notstart' %}
                                        未开始
                                    {% elif foo.state == 'nopass' %}
                                        <span style="color: red;">未通过</span>
                                    {% elif foo.state == 'suspension' %}
                                        <span style="color: red;">暂缓</span>
                                    {% elif foo.state == 'adopt' %}
                                        <span style="color: limegreen;">通过</span>
                                    {% else %}
                                        投票中
                                    {% endif %}
                                </div>
                                <div style="width: 11%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;border-right: none;">
                                    <a href="topic_voting_details.html?id={{ foo.id }}">查看</a>
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div><!--endprint-->
            </div>
        </div>
    </div>

    <div id="sign-in-model" class="shade1">
        <div id="sign-in-model" style="width: 70%;height: 700px;left: 50%;top: 50%;position: absolute;transform: translate(-50%, -50%);">
            <div style="width: 100%;height: 40px;font-size: 14px;">
                <div style="width: 100%;height: 40px;letter-spacing: 2px;">
                    <div onclick="close_sign_in()" style="width: 50px;height: 50px;text-align: center;line-height: 40px;cursor: pointer;float: right;">
                        <img src="../../static/personal_center/img/删除.png" alt="" style="width: 50px;height: 50px;">
                    </div>
                </div>
            </div>
            <div style="height: 95%;width: 100%;position: relative;">
                <div style="width: 700px;height: 700px;padding: 50px;position:absolute; top:0; right:0; bottom:0; left:0; margin:auto;background: white;">
                    <div id="output" style="width: 600px;height: 600px;"></div>
                </div>
            </div>
        </div>
    </div>

    <div id="new_models5" class="shade">
        <div id="new_models4" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 700px;height: 550px;background: #F5F5F5;z-index: 10000;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="box3" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;line-height: 40px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 80%;margin-left: 1%;display: inline-block;line-height: 0px;font-size: 16px;">
                        <div id="switch-sing" class="switch-div switch-active" onclick="SwitchContent('singDetail')">签到详情</div>
                        <div id="switch-leave" class="switch-div" onclick="SwitchContent('leaveDetail')">未签详情</div>
                    </div>
                    <span onclick="close_models3()" style="float: right;padding-right: 2%;cursor: pointer;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="width: 100%;height: 92.5%;">
                    <div id="singDetail" style="width: 100%;height: 100%;overflow: auto;">
                        <div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">
                            <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">签到人</div>
                            <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">签到时间</div>
                        </div>
                        <div id="bbbbb" style="width: 100%;">

                        </div>
                    </div>

                    <div id="leaveDetail" style="width: 100%;height: 100%;overflow: auto;display: none;">
                        <div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">
                            <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">请假人</div>
                            <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">请假时间</div>
                        </div>
                        <div id="aaaaa" style="width: 100%;">

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" src="../../static/personal_center/js/other/jquery.js"></script>
    <script src="../../static/administrative/layDate-v5.0.9/laydate/laydate.js"></script> <!-- 改成你的路径 -->
    <script type="text/javascript" src="../../static/personal_center/js/multiple-select.min.js"></script>
    <script type="text/javascript" src="../../static/personal_center/js/jquery.qrcode.min.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
            document.getElementById("personage").className = "add_class";
            document.getElementById("supervision_inspection_management").className = "add-nav-active";
        };

        lay('#version').html('-v' + laydate.v);

        //执行一个laydate实例
        laydate.render({
            elem: '#time_start' //指定元素
        });

        function open_nav(nav_id) {
            var nav_list = document.getElementsByClassName("nav_list");
            for (var i=0; i<nav_list.length; i++) {
                nav_list[i].style.display = "nome"
            }
            if (document.getElementById(nav_id).style.display === "none") {
                document.getElementById(nav_id).style.display = "block";
            }else {
                document.getElementById(nav_id).style.display = "none";
            }
        }

        function search_topic(committee_id, committee_name) {
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/supervision-inspection/list_of_Issues.html");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("committee_id="+committee_id);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200){
                            document.getElementById("topic_list").innerHTML = "";
                            document.getElementById("committee_title").innerText = committee_name;
                            document.getElementById("AttendMeeting").style.display = "block";
                            for (var i=0; i<JsonDate["data"].length; i++) {
                                console.log("======================", JsonDate["data"][i])
                                var html_str = `
                                    <div class="module1" style="width: 100%;">
                                        <div style="width: 3%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;cursor: move;border-left: none;">
                                            <i style="font-size: 14px;" class="gm-icon gm-icon-move"></i>
                                        </div>
                                        <div class="YbSerial" style="width: 3%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">`+JsonDate["data"][i]["serial"]+`</div>
                                        <div style="width: 34%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;padding-left: 3px;" title="`+JsonDate["data"][i]["topic_name"]+`"><a href="topic_voting_details.html?id=`+JsonDate["data"][i]["id"]+`">`+JsonDate["data"][i]["topic_name"]+`</a></div>
                                        <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;" title="`+JsonDate["data"][i]["number"]+`">`+JsonDate["data"][i]["number"]+`</div>
                                        <div style="width: 10%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">`+JsonDate["data"][i]["apply_user"]+`</div>
                                        <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">`+JsonDate["data"][i]["create_time"]+`</div>
                                        <div style="width: 13%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;">`+JsonDate["data"][i]["appove_time"]+`</div>
                                        <div style="width: 11%;height: 40px;line-height: 40px;border: #999999 solid 1px;border-top: none;border-left: none;text-align: center;color: #0b0b0b;display: inline-block;vertical-align: top;font-size: 14px;border-right: none;">
                                            <a href="topic_voting_details.html?id=`+JsonDate["data"][i]["id"]+`">查看</a>
                                        </div>
                                    </div>
                                `
                                $("#topic_list").append(html_str)
                            }
                        }else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
             };
        }

        function check_all_select(chose_id) {
            var check_box_list = document.getElementsByClassName("check-box");
            if (document.getElementById(chose_id).checked){
                for (var i=0; i<check_box_list.length; i++){
                    check_box_list[i].checked=true;
                }
            }else {
                for (var t=0; t<check_box_list.length; t++){
                    check_box_list[t].checked=false;
                }
            }
        }

        function online_tag(iss_id_list) {
            document.getElementById("new_models1").style.display = "table-row";
            document.getElementById("iss_summit_but").setAttribute("onclick", "will_meeting(" + JSON.stringify(iss_id_list) + ")")
        }

        function close_models() {
            document.getElementById("new_models1").style.display = "none";
        }

        function will_fun() {
            var iss_id_list = [];
            var check_box_list = document.getElementsByClassName("check-box");
            for (var i=0; i<check_box_list.length; i++){
                if (check_box_list[i].checked){
                    iss_id_list.push(check_box_list[i].id);
                }
            }

            if (iss_id_list.length === 0){
                document.getElementById("loading").style.display = "none";
                alert("请选择议题！");
                return false
            }
            online_tag(iss_id_list)
        }

        let title = document.querySelector("#box");
        let addForm = document.querySelector("#new_models");

        title.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm.offsetLeft;
            let y = e.pageY - addForm.offsetTop;

            document.addEventListener("mousemove", move);
            function move(e) {
                addForm.style.left = e.pageX - x + 'px';
                addForm.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function will_meeting(iss_id_list) {
            var meeting_time = document.getElementById("time_start").value;
            var meeting_adress =  $('#meeting_root option:selected').val();
            var notification = $("input[type=radio][name=notification]:checked").val();
            var ConferenceHost = document.getElementById("ConferenceHost").value;
            if (ConferenceHost === '0') {
                alert("请选择会议主持人！");
                return false
            }
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();

            xhr.open('post', "/supervision-inspection/the_agenda_meeting.html", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("notification="+String(notification)+"&meeting_adress="+String(meeting_adress)+"&meeting_time="+String(meeting_time)+"&id_list="+JSON.stringify(iss_id_list)+"&ConferenceHost="+String(ConferenceHost));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        alert("文件已发送至领导处！");
                        close_models();
                        location.reload();
                    }
                }
             };
        }

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function open_check_in_code() {
            document.getElementById("sign-in-model").style.display="table-row";
            document.getElementById("output").innerHTML = "";
            var timestamp = new Date().getTime();
            jQuery('#output').qrcode(toUtf8("https://oaapi.hbjsxrmyy.com/new-flow-logic/committee_attendance?meet_number={{ meet_number }}&flow_id=&timestamp=" + String(timestamp) + "&meeting_name={{ meeting_name }}"));
            interval = setInterval(create_sing_code,13000);
        }

        function create_sing_code() {
            document.getElementById("output").innerHTML = "";
            var timestamp = new Date().getTime();
            jQuery('#output').qrcode(toUtf8("https://oaapi.hbjsxrmyy.com/new-flow-logic/committee_attendance?meet_number={{ meet_number }}&flow_id=&timestamp=" + String(timestamp) + "&meeting_name={{ meeting_name }}"));
        }

        function toUtf8(str) {
            var out, i, len, c;
            out = "";
            len = str.length;
            for (i = 0; i < len; i++) {
                c = str.charCodeAt(i);
                if ((c >= 0x0001) && (c <= 0x007F)) {
                    out += str.charAt(i);
                } else if (c > 0x07FF) {
                    out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
                    out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
                    out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
                } else {
                    out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
                    out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
                }
            }
            return out;
        }

        function close_sign_in() {
            document.getElementById("sign-in-model").style.display="none";
            clearInterval(interval)
        }

        function model_line(type) {
            if (type === "start") {
                var alert_word = "是否确认开始会议？";
            }else {
                alert_word = "是否确认结束会议？";
            }
            var remind = confirm(alert_word)
            if (remind) {
                meeting_leader(type);
            }
        }

        function meeting_leader(type) {
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/supervision-inspection/committee_voting_topics.html");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("types="+type+"&meeting_name={{ meeting_name }}&meet_number={{ meet_number }}");
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate['code'] === 200){
                            alert("操作成功！");
                            if (type === "end") {
                                window.location.href = "/supervision-inspection/summary_of_issues.html";
                            }else {
                                window.location.reload();
                            }
                        }else {
                            alert(JsonDate['message']);
                        }
                    }
                }
            };
        }

        function SignDetail() {
            document.getElementById("new_models5").style.display = "table-row";
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/new-flow-logic/committe_attendanc_sign_detail");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("meet_number={{ meet_number }}&meeting_name={{ meeting_name }}");
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate['code'] === 200){
                            create_table_1(JsonDate["leave_dict"], JsonDate["sing_dict"])
                        }else {
                            alert(JsonDate['message']);
                        }
                    }
                }
            };
        }

        function create_table_1(json_date, sing_dict) {
            document.getElementById("aaaaa").innerHTML = "";
            document.getElementById("bbbbb").innerHTML = "";
            for (var a=0; a<json_date.length; a++) {
                var html_str = `<div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">
                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">
                                    `+json_date[a]["real_name"]+`</div>
                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">`+json_date[a]["time"]+`</div>
                            </div>`
                $("#aaaaa").append(html_str)
            }

            for (var b=0; b<sing_dict.length; b++) {
                var html_str1 = `<div style="width: 100%;height: 40px;border-bottom: #999999 solid 1px;">
                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;border-right: #999999 solid 1px;">
                                    `+sing_dict[b]["real_name"]+`</div>
                                <div style="width: 49%;height: 40px;text-align: center;line-height: 40px;display: inline-block;vertical-align: top;">`+sing_dict[b]["time"]+`</div>
                            </div>`
                $("#bbbbb").append(html_str1)
            }
        }

        function close_models3() {
            document.getElementById("new_models5").style.display = "none";
        }

        function SwitchContent(switch_tag) {
            if (switch_tag === 'singDetail') {
                document.getElementById('singDetail').style.display = "block";
                document.getElementById('leaveDetail').style.display = "none";
                document.getElementById("switch-sing").className = "switch-div switch-active";
                document.getElementById("switch-leave").className = "switch-div";
            }else {
                document.getElementById('leaveDetail').style.display = "block";
                document.getElementById('singDetail').style.display = "none";
                document.getElementById("switch-leave").className = "switch-div switch-active";
                document.getElementById("switch-sing").className = "switch-div";
            }
        }
    </script>
{% endblock %}
